﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<a href="/shopcategory.mrqa?action=admin">返回</a>
<br>
<span class="title1">礼品分类</span>
<table class="qlist" width="100%" align="center" cellpadding="0" cellspacing="0" style="background-color:#FAFCFC;border:1px solid #ccc;">
    <html:form action="/shopcategory" method="post" onsubmit="return validate(this);">
    <html:hidden property="action" value="update"/>
    <html:hidden property="categoryId" value="${shopCategory.id}"/>
    <tr>
        <td align="right">分类名</td>
        <td>
            <html:text property="name" value="${shopCategory.name}" size="20" />
        </td>
    </tr>
    <tr>
        <td align="right">E-mail</td>
        <td>
            <html:text property="email" value="${shopCategory.email}" size="20" />
        </td>
    </tr>
    <tr>
        <td align="right"></td>
        <td>
            <input type="submit" value="修改"/>
            <input type="button" value="删除" onclick="delCat(this.form)"/>
        </td>
    </tr>
    </html:form>
</table>
<script type="text/javascript">
		var contextPath = "<%=request.getContextPath()%>";
    function validate(pForm)
    {
        var name = pForm.name.value;
        if(name == "")
        {
            alert("[分类名]必须");
            pForm.name.focus();
            return false;        
        }
        
        var email = pForm.email.value;
        if(email == "")
        {
        	alert("[E-mail]必须");
        	pForm.email.focus();
        	return false;
        }
        return true;
    }
    function delCat(pForm){
    		var url = contextPath+"/shopcategory.mrqa?action=predelete&categoryId=<c:out value="${shopCategory.id}"/>";
        document.location.href = url;
    }
</script>